package com.example.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.data.request.ReqStudentList;
import com.example.data.response.RespUsernameAndPassword;
import com.example.data.response.ShowBaseStudentInfo;
import com.example.entity.Student;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * Author:yanghua
 * Date:2023/7/20 18:24
 */
@Mapper
public interface StudentDao extends BaseMapper<Student> {

    List<ShowBaseStudentInfo> getStudentList(ReqStudentList reqStudentList);

    Integer getStudentNum(ReqStudentList reqStudentList);

    @Update("update student set del = 1 where num_id = #{nid}")
    Integer deleteByNumId(String nid);


    ShowBaseStudentInfo selectStudentById(Long id);

    @Select("select username, password from student where num_id = #{nid} and del = 0")
    RespUsernameAndPassword getStudentUsernameAndPasswordByNid(String nid);

    @Select("select * from student where username = #{username} and del = 0")
    Student getStudent(String username);
}
